package com.atguigu.gulimail.ware.dao;

import com.atguigu.gulimail.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 *
 * @author songshaoqiu
 * @email songshaoqiu@gmail.com
 * @date 2022-01-07 17:31:40
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void updateWareNum(@Param("skuId") Long skuId, @Param("skuNum") Integer skuNum, @Param("wareId") Long wareId);

    Long getSkuStockBySkuId(@Param("skuId") Long skuId);

    List<Long> selectBySkuId(@Param("skuId") Long skuId);


    Long lockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("count") Integer count);

    void unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum, @Param("detailId")Long detailId);

}
